Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_ordered_columns and datetime_generator implementation + tests #313

Conversation

drahc1R
Copy link
Contributor

@drahc1R drahc1R commented Jul 17, 2023

Added order_generator to dataset_generator



class TestDatasetGenerator(unittest.TestCase):
def test_get_ordered_column_datetime(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests that get_ordered_column returns datetime numpy array in ascending order while still maintaining the original datetime format inserted into it

for i in range(len(output_data)):
self.assertTrue(np.array_equal(output_data[i], ordered_data[i]))

def test_get_ordered_column_datetime_descending(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests that get_ordered_column returns datetime numpy array in descending order while still maintaining the original datetime format inserted into it.

print(output_data[i], "GG", ordered_data[i])
self.assertTrue(np.array_equal(output_data[i], ordered_data[i]))

def test_get_ordered_column(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These last two tests test that get_ordered_column returns numpy array in ascending/descending order

auto-merge was automatically disabled July 20, 2023 14:39

Head branch was pushed to by a user without write access

@drahc1R drahc1R changed the title added order generator to dataset_generator get_ordered_columns and datetime_generator implementation Jul 25, 2023
@drahc1R drahc1R changed the title get_ordered_columns and datetime_generator implementation get_ordered_columns and datetime_generator implementation + tests Jul 25, 2023
auto-merge was automatically disabled July 25, 2023 21:06

Head branch was pushed to by a user without write access

Comment on lines +60 to +61
sorted_data = np.array(sorted(data, key=lambda x: x[1]))
sorted_data = sorted_data[:, 0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be sorting by the object or string, @taylorfturner thoughts here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't sorting by string cause it to sort alphabetically instead of by date?

Copy link
Contributor

@JGSweets JGSweets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix one test to clarify what we should see in the output for datetime.


def test_get_ordered_column(self):

data = OrderedDict(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should have datetime be in here too so we can see the exact output.

output_data.append(dg.get_ordered_column(data[data_type], data_type))
output_data = np.asarray(output_data)

self.assertTrue(np.array_equal(output_data, ordered_data))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of this and in the other tests, we can do np.testing.assert_array_equal I believe.

@drahc1R
Copy link
Contributor Author

drahc1R commented Jul 31, 2023

replaced by PR #323

@drahc1R drahc1R closed this Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request work_in_progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants